<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../script/imgPreview/baguetteBox.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/imgPreview/baguetteBox.js"></script>
    <script type="text/javascript" src="../../script/imgPreview/highlight.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<!-- header -->
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <div class="header">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack()" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>投票结果</h6>
        </div>
        <div class="head-action">
            <!-- <a href="javascript:void(0);" tapmode onclick="openModel()" class="action-btn"></a> -->
        </div>
    </div>
</div>
<!-- header end -->
<div class="mescroll" id="mescroll" style="padding-top: 1.6rem;">
    <div class="detail-section">
        <div class="detail">
            <div class="index-news">
                <ul id="voteDetail">
                    <li style="padding-top: 0;">
                        <div class="video-detail">
                            <h6 class="news-title" style="font-size:0.28rem;" id="title"></h6>
                            <div class="votePic" id="votePic"></div>
                            <div class="voteView">
                                <ul class="voteResult" id="entry">
                                    <!-- <li>
                                        <p class="multiline-ellipsis_3">戈贝尔 21分14篮板2盖帽</p>
                                        <div class="result">97票（0.3%）</div>
                                        <div class="percentage" style="width: 10%;"></div>
                                    </li>
                                    <li class="on">
                                        <p class="multiline-ellipsis_3">戈贝尔 21分14篮板2盖帽戈</p>
                                        <div class="result">97票（0.3%）</div>
                                        <div class="percentage" style="width: 20%;"></div>
                                    </li>
                                    <li data-id="4">
                                        <p class="multiline-ellipsis_3">戈贝尔 21分14篮板2盖帽戈</p>
                                        <div class="result">97票（0.3%）</div>
                                        <div class="percentage" style="width: 30%;"></div>
                                    </li> -->
                                </ul>
                                <div class="vote-note" id="note">
                                    <!-- <p>单选</p>
                                    <p>2020/01/02 14:30截止</p> -->
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>


</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/zy.media.min.css"/>
<script type="text/javascript" src="../../script/zy.media.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/mescroll.min.css"/>
<script type="text/javascript" src="../../script/mescroll.min.js"></script>
<script type="text/javascript" src="../../script/clipboard.min.js"></script>
<script type="text/javascript">
    var vote_id = '';//圈子id
    var member_id = '';//用户id
    var type = '';
    var pullUp = true;
    apiready = function () {

        setFixStatusBar(); //设置状态栏
        keybackListener()
        vote_id = api.pageParam.vote_id;
        type = api.pageParam.type;
        // vote_id = 6;
        // type = 2;


        getVoteDetail()

        SystemCheckVersion()


    };

    /*下拉刷新的回调 */
    function downCallback() {
        getVoteDetail()

        //mescroll.endErr();
    }

    //创建MeScroll对象
    var mescroll = new MeScroll("mescroll", {
        down: {
            auto: false, //是否在初始化完毕之后自动执行下拉回调callback; 默认true
            callback: downCallback //下拉刷新的回调
        }
    });

    //详情
    function getVoteDetail() {

        var param = {
            token: $api.getStorage('token'),
            vote_id: vote_id,
            type: type,//为1表示新闻投票 2会员发布投票
        }
        pop.loading()
        getAjax(Interface.vote_result, param, function (res) {
            console.log(jsonChange(res));
            var data = res.data;

            var html = '';
            if(data.status == 1){
                html = '<span class="status being">进行中</span>'+data.title;
            }else {
                html = '<span class="status end">已结束</span>'+data.title;
            }
            $("#title").html(html);

            if(isDefine(data.icon_path)){
              var img = '<img src="'+ajaxUrl+data.icon_path+'" alt="" />'
              $("#votePic").html(img);
            }

            if(isDefine(data.entry)){
              var entry = '';
              $.each(data.entry,function(k,ktem){
                entry += '<li>'+
                          '    <p class="multiline-ellipsis_3">'+ktem.content+'</p>'+
                          '    <div class="result">'+ktem.number+'票（'+(parseFloat(ktem.entry_rate)*100).toFixed(2)+'%）</div>'+
                          '    <div class="percentage" style="width: '+(parseFloat(ktem.entry_rate)*100).toFixed(2)+'%;"></div>'+
                          '</li>';
              })
              $("#entry").html(entry);
            }
            var stypeNote = '';
            if(data.stype == 1){
                stypeNote = '<p>单选</p><p>'+data.over_time_date+'截止</p>';
            } else {
                stypeNote = '<p>多选；最多可选'+data.many_number+'项，最少'+data.less_number+'项</p><p>'+data.over_time_date+'截止</p>';
            }
            $("#note").html(stypeNote)

            mescroll.endErr()
            pop.close();
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
            mescroll.endErr()
        })
    }



</script>
